var JieFrame = function(aoParentGrid){
	if(aoParentGrid == null) throw new Error(sGmsg["ROW_002"]);
	
	this.oParentGrid = aoParentGrid;
	
	this.FIXED_HEADER = {
		FRAME_BOX : document.createElement(Properties.system.FRAME_TAG),
		DATA_BOX :  document.createElement(Properties.system.FRAME_DATA_BOX_TAG)
	};
	this.HEADER = {
		FRAME_BOX : document.createElement(Properties.system.FRAME_TAG),
		DATA_BOX :  document.createElement(Properties.system.FRAME_DATA_BOX_TAG)
	};
	this.HEADER_SPACE = {
		FRAME_BOX : document.createElement(Properties.system.FRAME_TAG),
		DATA_BOX :  document.createElement(Properties.system.FRAME_DATA_BOX_TAG)
	};
	//data area
	this.FIXED_DATA = {
		FRAME_BOX : document.createElement(Properties.system.FRAME_TAG),
		DATA_BOX :  document.createElement(Properties.system.FRAME_DATA_BOX_TAG)
	};
	this.DATA_AREA = {
		FRAME_BOX : document.createElement(Properties.system.FRAME_TAG),
		DATA_BOX :  document.createElement(Properties.system.FRAME_DATA_BOX_TAG)
	};
	this.PORTRAIT_SCROLL = {
		FRAME_BOX : document.createElement(Properties.system.FRAME_TAG),
		DATA_BOX :  document.createElement(Properties.system.FRAME_DATA_BOX_TAG)
	};
	//bottom
	this.FIXED_BOTTOM = {
		FRAME_BOX : document.createElement(Properties.system.FRAME_TAG),
		DATA_BOX :  document.createElement(Properties.system.FRAME_DATA_BOX_TAG)
	};
	this.BOTTOM_SCROLL = {
		FRAME_BOX : document.createElement(Properties.system.FRAME_TAG),
		DATA_BOX :  document.createElement(Properties.system.FRAME_DATA_BOX_TAG)
	};
	this.BOTTOM_SAPCE = {
		FRAME_BOX : document.createElement(Properties.system.FRAME_TAG),
		DATA_BOX :  document.createElement(Properties.system.FRAME_DATA_BOX_TAG)
	};
}

JieFrame.prototype = {
	makeFrame : function(aiFixedAreaWidth, aiHeaderHeight, aiDataAreaWidth, aiDataFrameWidth, aiScrollWidth, aiDataAreaHeight){
		//alert(aiHeaderHeight + ";" + iScrollWidth + ";" + aiDataAreaWidth + ";" + this.iDataAreaHeight);
	//--------------------------------------  header    -----------------------------------------
	//alert("FIXED_HEADER");
		//FIXED_HEADER
		this.FIXED_HEADER.FRAME_BOX.style.width = aiFixedAreaWidth + "px";
		this.FIXED_HEADER.FRAME_BOX.style.height = aiHeaderHeight + "px";
	//	this.FIXED_HEADER.FRAME_BOX.style.clear = "left";
		this.oParentGrid.element.appendChild(this.FIXED_HEADER.FRAME_BOX);
		
		this.FIXED_HEADER.DATA_BOX.style.width = aiFixedAreaWidth + "px";
		this.FIXED_HEADER.DATA_BOX.style.height = aiHeaderHeight + "px";
		this.FIXED_HEADER.FRAME_BOX.appendChild(this.FIXED_HEADER.DATA_BOX);
	//alert("HEADER");
		//HEADER
		this.HEADER.FRAME_BOX.style.width = aiDataFrameWidth + "px";
		this.HEADER.FRAME_BOX.style.height = aiHeaderHeight + "px";
		this.oParentGrid.element.appendChild(this.HEADER.FRAME_BOX);
		
		this.HEADER.DATA_BOX.style.width = aiDataAreaWidth + "px";
		this.HEADER.DATA_BOX.style.height = aiHeaderHeight + "px";
		this.HEADER.FRAME_BOX.appendChild(this.HEADER.DATA_BOX);
	//alert("HEADER_SPACE");
		//HEADER_SPACE
		this.HEADER_SPACE.FRAME_BOX.style.width = aiScrollWidth + "px";
		this.HEADER_SPACE.FRAME_BOX.style.height = aiHeaderHeight + "px";
		this.oParentGrid.element.appendChild(this.HEADER_SPACE.FRAME_BOX);
		
		this.HEADER_SPACE.DATA_BOX.style.width = aiScrollWidth + "px";
		this.HEADER_SPACE.DATA_BOX.style.height = aiHeaderHeight + "px";
		this.HEADER_SPACE.FRAME_BOX.appendChild(this.HEADER_SPACE.DATA_BOX);
	//--------------------------------  data area  --------------------------------------------------------
	//alert("FIXED_DATA");
		//FIXED_DATA
//		this.FIXED_DATA.FRAME_BOX.name="333";
		this.FIXED_DATA.FRAME_BOX.style.width = aiFixedAreaWidth + "px";
		this.FIXED_DATA.FRAME_BOX.style.height = aiDataAreaHeight + "px";
		this.oParentGrid.element.appendChild(this.FIXED_DATA.FRAME_BOX);
		
		this.FIXED_DATA.DATA_BOX.style.width = aiFixedAreaWidth + "px";
//		this.FIXED_DATA.DATA_BOX.style.height = aiDataAreaHeight + "px";
		this.FIXED_DATA.DATA_BOX.style.height = 1 + "px";
		this.FIXED_DATA.FRAME_BOX.appendChild(this.FIXED_DATA.DATA_BOX);
	//alert("DATA_AREA");
		//DATA_AREA
		this.DATA_AREA.FRAME_BOX.style.width = aiDataFrameWidth + "px";
		this.DATA_AREA.FRAME_BOX.style.height = aiDataAreaHeight + "px";
		this.oParentGrid.element.appendChild(this.DATA_AREA.FRAME_BOX);
		
		this.DATA_AREA.DATA_BOX.style.width = aiDataAreaWidth + "px";
//		this.DATA_AREA.DATA_BOX.style.height = aiDataAreaHeight + "px";
		this.DATA_AREA.DATA_BOX.style.height = 1 + "px";
		this.DATA_AREA.FRAME_BOX.appendChild(this.DATA_AREA.DATA_BOX);
	//alert("PORTRAIT_SCROLL");
		//PORTRAIT_SCROLL
		this.PORTRAIT_SCROLL.FRAME_BOX.style.width = aiScrollWidth + "px";
		this.PORTRAIT_SCROLL.FRAME_BOX.style.height = aiDataAreaHeight + "px";
		this.PORTRAIT_SCROLL.FRAME_BOX.style.overflow = "auto";
		this.PORTRAIT_SCROLL.FRAME_BOX.onscroll = this.moveScrollPortrait;
		this.PORTRAIT_SCROLL.FRAME_BOX.objectList = new Array(this.FIXED_DATA.FRAME_BOX, this.DATA_AREA.FRAME_BOX);
		this.oParentGrid.element.appendChild(this.PORTRAIT_SCROLL.FRAME_BOX);
		
		this.PORTRAIT_SCROLL.DATA_BOX.style.width = aiScrollWidth + "px";
		this.PORTRAIT_SCROLL.DATA_BOX.style.height = 1 + "px";
		this.PORTRAIT_SCROLL.DATA_BOX.style.height = aiDataAreaHeight + "px";
		this.PORTRAIT_SCROLL.FRAME_BOX.appendChild(this.PORTRAIT_SCROLL.DATA_BOX);
	//-------------------------------  bottom     -----------------------------------------------------
	//alert("FIXED_BOTTOM");
		//FIXED_BOTTOM
		this.FIXED_BOTTOM.FRAME_BOX.style.width = aiFixedAreaWidth + "px";
		this.FIXED_BOTTOM.FRAME_BOX.style.height = aiScrollWidth + "px";
	//	this.FIXED_BOTTOM.FRAME_BOX.style.clear = "left";
		this.oParentGrid.element.appendChild(this.FIXED_BOTTOM.FRAME_BOX);
		
		this.FIXED_BOTTOM.DATA_BOX.style.width = aiFixedAreaWidth + "px";
		this.FIXED_BOTTOM.DATA_BOX.style.height = aiScrollWidth + "px";
		this.FIXED_BOTTOM.FRAME_BOX.appendChild(this.FIXED_BOTTOM.DATA_BOX);
	//alert("BOTTOM_SCROLL");
		//BOTTOM_SCROLL
		this.BOTTOM_SCROLL.FRAME_BOX.style.width = aiDataFrameWidth + "px";
		this.BOTTOM_SCROLL.FRAME_BOX.style.height = aiScrollWidth + "px";
		this.BOTTOM_SCROLL.FRAME_BOX.style.overflow = "auto";
		this.BOTTOM_SCROLL.FRAME_BOX.onscroll = this.moveScrollLandscape;
		this.BOTTOM_SCROLL.FRAME_BOX.objectList = new Array(this.HEADER.FRAME_BOX, this.DATA_AREA.FRAME_BOX);
		this.oParentGrid.element.appendChild(this.BOTTOM_SCROLL.FRAME_BOX);
		
		this.BOTTOM_SCROLL.DATA_BOX.style.width = aiDataAreaWidth + "px";
		this.BOTTOM_SCROLL.DATA_BOX.style.height = aiScrollWidth + "px";
		this.BOTTOM_SCROLL.FRAME_BOX.appendChild(this.BOTTOM_SCROLL.DATA_BOX);
	//alert("BOTTOM_SAPCE");
		//BOTTOM_SAPCE
		this.BOTTOM_SAPCE.FRAME_BOX.style.width = aiScrollWidth + "px";
		this.BOTTOM_SAPCE.FRAME_BOX.style.height = aiScrollWidth + "px";
		this.oParentGrid.element.appendChild(this.BOTTOM_SAPCE.FRAME_BOX);
		
		this.BOTTOM_SAPCE.DATA_BOX.style.width = aiScrollWidth + "px";
		this.BOTTOM_SAPCE.DATA_BOX.style.height = aiScrollWidth + "px";
		this.BOTTOM_SAPCE.FRAME_BOX.appendChild(this.BOTTOM_SAPCE.DATA_BOX);

	},
	moveScrollLandscape : function(){
		var oList = this.objectList;
		for(var i=0; i<oList.length; i++){
//			alert(oList[i].tagName);
		
			oList[i].scrollLeft = this.scrollLeft;
		}
	},
	moveScrollPortrait : function(){
		
		var oList = this.objectList;
		//alert(oList.length);
		for(var i=0; i<oList.length; i++){
//			alert(oList[i].name);
			oList[i].scrollTop = this.scrollTop;
		}
	}
};
